﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FrienDev.BusinessRules;
using FrienDev.Data;

public partial class Controls_Club_PostBoard : System.Web.UI.UserControl
{
    private int m_ClubId;
    private int m_Type;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.QueryString["clubId"]))
        {
      
            bt_Submit.Click += new EventHandler(bt_Submit_Click);
            m_ClubId = Convert.ToInt32(Request.QueryString["clubId"]);
            //hl_MoreMessage.NavigateUrl = "/Activity/ActivityMessageBoard.aspx?activityId=" + m_ActivityId;
        }
    }

   void bt_Submit_Click(object sender, EventArgs e)
    {
        if (txt_MesasgeWords.Text.Trim() != ""&&txt_Title.Text.Trim()!="")
        {
            
            Post currentPost=ClubRules.Instance.SendMessage(UserRules.Instance.GetCurrentUserId(),txt_Title.Text, txt_MesasgeWords.Text, m_ClubId);
            txt_Title.Text = "";
            txt_MesasgeWords.Text = "";
            Response.Redirect("~/Club/PostDetail.aspx?clubId=" + m_ClubId + "&ParentId=" + currentPost.ParentId.ToString());
        }
    }

    void bt_Page_Click(object sender, EventArgs e)
    {
        Button btPage = sender as Button;
        
    }

    

    #region Property
    public int ShowType  //0--简化留言板，1--更多留言板
    {
        set
        {
            this.m_Type = value;
        }
    }
    #endregion
}
